<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 首字母大写

        // 构造函数 解决了 实例化对象不能正确指向它的构造器这个问题
        //         依然没有解决方法共享的问题

        function Person(name , age , sex) {
            this.name = name ;
            this.age = age ;
            this.sex = sex ; 
            this.say = function() {
                console.log('hi');
            }
        }

        const p1 = new Person('cc' , 18 , '女');
        const p2 = new Person('yy' , 28 , '女');

        console.log(p1.say === p2.say);

    </script>
    
</body>
</html>